﻿@using Website.Models
@{
    IEnumerable<PriceLevel> priceLevels = ViewBag.PriceLevels as IEnumerable<PriceLevel>;
    int priceLevelID = ViewBag.PriceLevelID != null ? (int)ViewBag.PriceLevelID : -1;
    int index = 0;
    foreach(PriceLevel pl in priceLevels)
    {
        index++;
        bool isChecked = (priceLevelID != -1 && priceLevelID == pl.PriceLevelID);
        <span class="priceLevel">
            @if(isChecked)
            {
                <input type="radio" name="PriceLevelID" id="PriceLevelID" value="@pl.PriceLevelID" checked="checked"/>
            }
            else
            {
                <input type="radio" name="PriceLevelID" id="PriceLevelID" value="@pl.PriceLevelID" />
            }
            [@pl.PriceLevelCode] @pl.Price.ToString("#,##0.##") VND
        </span>
            if (index % 3 == 0)
            {
            <br/>
        }
    }
}